<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel=stylesheet href="css/style.css" type="text/css">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic-el" prefix="logic" %>
<title>Fantacalcio | Squadra: ${squadra.nome }</title>
</head>
<body>
	<c:if test="${userInSession == null}">
		<c:redirect url="Logout.do"></c:redirect>
	</c:if>
		
	<c:import url="/head.jsp"/>
	
	<c:import url="/menu.jsp"/>
	
	<c:import url="menuSquadra.jsp"/>
	
	<div class="context">
		<h1> Squadra: ${squadra.nome } </h1>
		<table>
			<tr>
				<td><label class="prop">Id:</label></td>
				<td>${squadra.id }</td>
			</tr>
			<tr>
				<td><label class="prop">Nome:</label></td>	
				<td>${squadra.nome }</td>
			</tr>
			<tr>
				<td><label class="prop">Crediti:</label></td>
				<td>${squadra.crediti }</td>
			</tr>
			<tr>
				<td><label class="prop">Presidente:</label></td>
				<td><a href="PrepareCRUDUserAction.do?codOp=apri&id=${squadra.presidente.id }">${squadra.presidente.cognome } ${squadra.presidente.nome }</a></td>
			</tr>
			<tr>
				<td><label class="prop">Giocatori:</label></td>
			</tr>
			<tr>
				<td></td>
				<td>
					<c:forEach var="giocatore" items="${listaGiocatori }" >
						<p><a href="PrepareCRUDGiocatoreAction.do?codOp=apri&id=${giocatore.id }">
							${giocatore.ruolo } - ${giocatore.cognome }</a></p>
					</c:forEach>
				</td>
			</tr>
		</table>
		<c:if test="${userInSession.role.codRole == 'ADMIN'}">
			<html:form action="PrepareCRUDSquadraAction.do">
			<html:hidden property="id" value="${squadra.id }"/>
			<html:hidden property="codOp" value="modifica"/>
			<div class="bottomS"><html:submit value="Modifica" /></div>
			</html:form>
			<html:form action="ConfermaDeleteSquadraAction.do">
			<html:hidden property="id" value="${squadra.id }" />
			<html:hidden property="codOp" value="cancella"/>
			<div class="bottomD"><html:submit value="Cancella"  onclick="return confirm('Confermare cancellazione?');"/></div>
			</html:form>
		</c:if>
	</div>
	
	<c:import url="/footer.jsp"/>

</body>
</html>